# Disable in-source builds to prevent source tree corruption.
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
         message(FATAL_ERROR "FATAL: In-source builds are not allowed.
        You should create a separate directory for build files.")
endif()

cmake_minimum_required(VERSION 3.0.0)

if(POLICY CMP0048)
  cmake_policy(SET CMP0048 NEW)
endif()

PROJECT(coap-demo)

SET(CMAKE_BUILD_TYPE Release)

SET(PRO_TOP_PATH "${PROJECT_SOURCE_DIR}")

# 指定 C 和 C++ 编译器
if (AARCH64_HOST)
  set(CMAKE_C_COMPILER arm-linux-musleabi-gcc)
  set(CMAKE_CXX_COMPILER arm-linux-musleabi-g++)
  set(CMAKE_INSTALL_LIBDIR "/data/coap-demo/libs")
  set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
endif()  #USE_NETWORK_TEST





include_directories(include/)
include_directories(coap-resource.h
                    coap-server-implement.h)

find_library(COAP_LIB coap-2 PATHS ./)

add_executable(coap-server coap-server.c
		    	    coap-resource.c
		          coap-server-implement.c)
target_link_libraries(coap-server ${COAP_LIB})


